const jwt = require('koa-jwt');
const Router = require('koa-router');
const router = new Router({prefix:'/users'});
const { find,findById,create,delete:del,updateUsername,updatePassword,login,clockIn} = require('../controllers/users');
const {secret} = require('../config/index');
const auth = jwt({ secret });

router.get('/',find);
router.get('/:id',auth,findById);
router.post('/',create);
router.delete('/:id',del);

//登录
router.post('/login',login);

router.patch(`/updatePassword`,auth,updatePassword)

//打卡
router.patch('/clockIn',auth,clockIn);
module.exports = router;